#ifndef LIGHT_H
#define LIGHT_H

#include "common.h"
#include "color.h"
#include "vector3.h"

class Scene;

class Light
{
public:
	Light(Scene* scene)
		: scene(scene) {}

	// Returns amount of light reaching some point in
	// space from this particular light source
	virtual Color radiance(const Vector3& p, const Vector3& n) = 0;
	
protected:
	Scene* scene;
};

class PointLight : public Light
{
public:
	PointLight(Scene* scene, const Vector3& pos, const Color& color)
		: Light(scene), pos(pos), color(color) {}


	virtual Color radiance(const Vector3& p, const Vector3& n)
	{
		Vector3 to_light = pos - p;
		to_light.normalize();
		float k = Vector3::dot(to_light, n);

		return color * k;
	}

private:
	Color color;
	Vector3 pos;

};

#endif
